%% Sources of premeum (Table 6A)
% PRisk and risk measures
% FM regressions
clear betas b t_stat
format short
for i = 1:size(call_deltahedge_returns_rb,1)
    % INSERT Y and X VARIABLES HERE FOR DIFFERENT SPECIFICATIONS %%%%%%%%%
    Y = Stock_RNV(i,:)'; % Change different measure here 

    X = [ones(size(Y)), Stock_PRisk(i,:)', Stock_PSentiment(i,:)', Stock_Betas_EPU(i,:)' ...
         log(Stock_CAP(i,:)'), Stock_BM(i,:)', Stock_IdioVol(i,:)', Stock_reversal(i,:)' ...
         Stock_Momentum(i,:)', Stock_illiquidity(i,:)', Stock_Inst(i,:)', Stock_Leverage(i,:)' ...
         Stock_GrossProfit(i,:)'];
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

    betas(i,:) = regress(Y,[X]);                                           
end
clear stats Y X i

for i = 1:size(betas,2)
   nw_stats = nwest(betas(:,i),ones(size(betas(:,i))),4);
   b(i,1) = nw_stats.beta;
   t_stat(i,1) = nw_stats.tstat;
end
clear nw_stats i 

%% Volatility risk vs jump risk (Table 6B)
% FM regressions
clear betas b t_stat
format short
for i = 1:size(call_deltahedge_returns_rb,1)
    % INSERT Y and X VARIABLES HERE %%%%%%%%%%%%%%%%%%%%%
    Y = call_deltavega_neutral_returns(i,:)'*100; 
    X = [ones(size(Y)), Stock_PRisk(i,:)', Stock_PSentiment(i,:)', Stock_Betas_EPU(i,:)' ...
         log(Stock_CAP(i,:)'), Stock_BM(i,:)', Stock_IdioVol(i,:)', Stock_reversal(i,:)' ...
         Stock_Momentum(i,:)', Stock_illiquidity(i,:)', Stock_Inst(i,:)', Stock_Leverage(i,:)' ...
         Stock_GrossProfit(i,:)'];
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

    betas(i,:) = regress(Y,[X]);                                           
end
clear stats Y X i

for i = 1:size(betas,2)
   nw_stats = nwest(betas(:,i),ones(size(betas(:,i))),4);
   b(i,1) = nw_stats.beta;
   t_stat(i,1) = nw_stats.tstat;
end
clear nw_stats i 